package org.example.maven.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.maven.pojo.Era;
import org.example.maven.pojo.eCharts.EraDistributionDTO;

import java.util.List;

@Mapper
public interface eraMapper {
    @Select("select *from era")
    List<Era> getAllEra();

    //获取藏品年代环形图的数据
    @Select("SELECT period as era, COUNT(*) AS count FROM collection_details GROUP BY era")
    List<EraDistributionDTO> getEraByCollection();

    //根据年代获取年代编号
    @Select("select id from era where period=#{period}")
    String getEraIdByEra(String period);
}
